﻿using System;
using System.Web;
using Core.Library;

namespace DataObject
{
    public class UserHelpers
    {                
        public static bool IsLoggedIn()
        {
            try { return ConvertUtility.ToBoolean(HttpContext.Current.Session[Constants.SESSION_IS_LOGGED_IN]); }
            catch { return false; }            
        }

        public static string GetCurrentShoppingCart()
        {
            try { return HttpContext.Current.Session[Constants.SESSION_SHOPPING_CART].ToString(); }
            catch { return string.Empty; }
        }

        public static string GetCurrentUserName()
        {
            try { return HttpContext.Current.Session[Constants.SESSION_USERNAME].ToString(); }
            catch { return string.Empty; }
        }

        public static string GetCurrentAvatar()
        {
            try { return HttpContext.Current.Session[Constants.SESSION_AVATAR].ToString(); }
            catch { return string.Empty; }
        }
    }
}
